package com.yxw.live_vod_backend_facade.feign;

import com.yxw.live_vod_backend_facade.dto.ProductFeignQueryDTO;
import com.yxw.live_vod_backend_facade.vo.ProductSpecificationVO;
import com.yxw.live_vod_backend_facade.vo.ProductVO;
import com.yxw.yxnet_cd_center.common.dto.PageVO;
import com.yxw.yxnet_cd_center.common.utils.BaseResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 商品feign
 * @author Administrator
 */
@FeignClient(name = "live-vod-backend-boot", contextId = "product")
public interface ProductFeignClient {

    @ApiOperation("根据Id获取商品详情")
    @PostMapping("/api/product/get_product_by_id")
    public BaseResult<ProductVO> getProductById(@RequestParam("productId") Long productId);

    @ApiOperation("获取商品列表")
    @PostMapping("/api/product/get_product_list")
    public BaseResult<PageVO<ProductVO>> getProductList(@RequestBody @Validated ProductFeignQueryDTO queryDTO);

    @ApiOperation("将redis中的库存相关取出并保存到数据库")
    @PostMapping("/api/product/get_product_stock")
    public BaseResult getProductStock(@RequestParam("productId") Long productId);

    @ApiOperation("定时任务将点播商品详情存入数据库")
    @PostMapping("/api/product/addVodProductClickJob")
    public BaseResult addVodProductClickJob();

    @ApiOperation("根据商品ID获取对应商品规格列表信息")
    @PostMapping("/api/product/get_product_specification_by_id")
    public BaseResult<List<ProductSpecificationVO>> getProductSpecificationById(@RequestParam("productId") Long productId);

    @ApiOperation("根据商品系列号获取商品列表")
    @PostMapping("/api/product/get_product_by_num")
    public BaseResult<List<ProductVO>> getProductByNum(@RequestParam("productSeriesNum") String productSeriesNum);

    @ApiOperation("商品上架/下架")
    @PostMapping("/api/product/is_put_away_by_id")
    public BaseResult isPutAwayById(@RequestParam("productId") String productId,
                                    @RequestParam("productStatus") Integer productStatus);
}
